# src/calphad/__init__.py

from src.calphad.base import CalphadBase
from src.calphad.calphadpy import CalphadPy
# from src.calphad.calphadopen import CalphadOpen


def create_calculator(tdb_file: str, engine: str = "p"):
    """Create a calculator instance.

    Args:
        tdb_files: TDB file path
        engine: Calculator engine. Defualts to use PyCalphad
    Returns:
        CalphadBase
    """
    engine = engine.lower()
    if engine.startswith("p"):
        return CalphadPy(tdb_file)
    elif engine.startswith("o"):
        # retutn CalphadOpen(tdb_file)
        raise NotImplementedError("OpenCalphad is not implemented yet.")
    else:
        raise ValueError(f"Unsupported engine: {engine}. Use 'p' for PyCalphad or 'o' for OpenCalphad.")
